onPostPublish
Callback to receive the data published from the post. This callback is available in the createPost method and is triggered when the user clicks the "Publish" button.
Usage
predis.createPost({
onPostPublish: function (error, data) {
if (error) {
console.error("Error publishing new post:", error);
} else {
console.log("New post published successfully:", data);
}
},
});
Parameters
| Name | Description | Type | Required |
|---|---|---|---|
error | Error triggered when the post failed to publish otherwise null | Error | yes |
data | The data of the published post inthe format given below. | Object | yes |
data.media_url | An array containing URL(s) of the published media. This can be a URL for a jpeg or mp4 file.In case when data.media_type is single_image or video the array will contain only one item, while in case of carousel it can contain multiple items. | Array | yes |
data.post_id | An unique ID to identify the published post. | String | yes |
data.thumb_url | An URL for the thumbnail of the published media. | String | yes |
data.media_type | Media type of the published media. Can be one of single_image, carousel or video | String | yes |
data.caption | Caption of the generated content. | String | yes |